package com.zx.cloud.domain.enums;

import com.zx.cloud.common.mybatis.handler.CodeEnum;

public enum FileType implements CodeEnum<FileType> {

	IDENTITY_CARD(0, "身份证"), HUMAN_FACE(1, "活体照"), USER_IMAGE(2, "用户头像"), OTHER(10, "其它");

	private int code;
	private String desc;

	/**
	 * 通过枚举<code>name</code>获取枚举
	 */
	public static FileType getEnumByCode(Integer code) {
		if (code == null) {
			return null;
		}
		for (FileType enumm : FileType.values()) {
			if (enumm.getCode() == code.intValue()) {
				return enumm;
			}
		}
		return null;
	}

	private FileType(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	@Override
	public int getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}